from cfg.exts import db
import sqlalchemy as sql
from datetime import datetime


# 模型
# 用户
class UserModel(db.Model):
    __tablename__ = "user"
    id = sql.Column(sql.BIGINT, primary_key=True, autoincrement=True)
    username = sql.Column(sql.VARCHAR(100), nullable=False)
    password = sql.Column(sql.VARCHAR(120), nullable=False)

    def toStr(self):
        return {
            "id": self.id,
            "username": self.username,
            "password": self.password
        }
